<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>wx博客系统</title>
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/bootstrap.min.css">
		<style>
			body{background-color:#31B2F3;}
			.body-center{background: #FFF;width: 450px;
			height: 500px;
			margin:60px auto;
			border-radius: 6px;
			box-shadow:0px 0px 10px #DDD;
			padding:15px;
			}
			.body-center h3,.body-center h4{margin:0;padding:0;text-align: center;}
			.body-center h3{line-height: 2.5;padding-top: 25px;color:#777}
			.body-center h4{font-size:.9em;color:#AAA;}
			form{margin:20px 25px;}
		</style>
	</head>
	<body>
		<div class="body-center">
			<h3>Virus博客系统-用户注册</h3>
			<h4>立即注册，一分钟快速搭建个人博客！</h4>
			<form>
				<div class="form-group">
				    <input type="text" name="account" class="form-control" id="account" placeholder="账号">
				</div>
				<div class="form-group">
				    <input type="password" name="passwd" class="form-control" id="passwd" placeholder="密码">
				</div>
				<div class="form-group">
				    <input type="password" name="repasswd" class="form-control" id="repasswd" placeholder="确认密码">
				</div>
				<div class="form-group">
				    <input type="email" name="email" class="form-control" id="email" placeholder="邮箱">
				</div>
				<div class="form-group form-inline">
				    <input type="text" name="code" class="form-control" id="code" placeholder="验证码" style="width: 90px;">
					<img src="{:captcha_src()}" alt="captcha" style="height: 35px; cursor: pointer;" onclick="this.src='{:captcha_src()}?'+Math.random();">
				</div>
				<input type="button" id="btnReg" value="立即注册" class="btn btn-success btn-lg btn-block"/>
				<a href="{:url('index/Index/index')}" class="btn btn-danger btn-lg btn-block">登录</a>
			</form>
		</div>

		<script src="__INDEX__/js/jquery-2.1.4.min.js"></script>
		<script src="__ADMIN__/lib/layui/lay/modules/layer.js"></script>
		<script type="text/javascript">
			$(function () {
				$('#btnReg').click(function (event) {
					event.preventDefault();
					$.ajax({
						type: 'post',
						url: "{:url('index/Index/reg')}",
						data: $('form').serialize(),
						dataType: 'json',
						success: function (res) {
							if (res.code == 1) {
								layer.msg(res.msg, {icon:1}, function () {
									location.href = "{:url('index/Index/index')}";
								});
							} else {
								layer.open({
									title: "注册",
									content: res.msg,
									icon:5,
									anim:6
								})
							}
						}
					})
				});
			});
		</script>
	</body>
</html>
